home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 6527 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: ix.netcom.com!netnews
  2. From: judgemi@ix.netcom.com(Michael Judge )
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Global Variables
  5. Date: 9 Feb 1996 04:48:36 GMT
  6. Organization: Netcom
  7. Message-ID: <4fejn4$jt8@reader2.ix.netcom.com>
  8. References: <4fefb3$dhf@tofu.alt.net>
  9. NNTP-Posting-Host: ix-bst-ma1-22.ix.netcom.com
  10. X-NETCOM-Date: Thu Feb 08  8:48:36 PM PST 1996
  11.  
  12. In <4fefb3$dhf@tofu.alt.net> Larry Buller <ljbuller@mail.btigate.com>
  13. writes: 
  14. >
  15. >Help!!! I'm using visualc++ 4.0.  What I want to do is recall
  16. information 
  17. >from an ini file... I already know how to do that.  What I can't seem
  18. to 
  19. >figure out is how to reference global variables in other classes.  For
  20.  
  21. >instance I can declare a variable outside of functions and class and
  22. That 
  23. >is supposed to make it global.  If I delcare x in 1.h and define it in
  24.  
  25. >1.cpp then try to refer to x in 2.cpp I get an undeclared variable
  26. error. 
  27. >If I make sure the declaration also exists in the 2.h, then I get a
  28. linker 
  29. >error.  I know this has got to be a real simple answer, but I'll be
  30. darned 
  31. >if I can find the answer.  Any body got help for this soul lost in c++
  32.  
  33. >hell?   Larry Buller
  34. >
  35.  
  36. I believe what you want to do is have a common ".h" file like
  37. ---------------------
  38. //this is the l.h file
  39.  
  40.  
  41. class declarations
  42. {.
  43.